<?php
include_once("{$_SERVER['DOCUMENT_ROOT']}/header.php");
include_once(PHP_ROOT."/class/db/Db.php");
if ($_SESSION['member_id']) {
    echo"이미 로그인 되어있습니다.";
} else {
    $r = new Db();
    $result = $r->return_result_by_array('member', "where m_id='$id' and m_passwd='$passwd' ", "*");
    if ($result['m_id']) {
        // 세션을 굽습니다.
        $_SESSION['uid'] = $result['uid'];
        $_SESSION['member_id'] = $result['m_id'];
        $_SESSION['member_name'] = $result['m_name'];
        $_SESSION['member_email'] = $result['m_email'];
        $_SESSION['member_level'] = $result['m_level'];
        $_SESSION['member_password'] = $result['m_passwd'];
        $_SESSION['member_log'] = $result['m_log']+1;
        $log = $result['m_log'] + 1;
        $r->update("member", "where uid = '$result[uid]'", "m_log=$log");
        echo"로그인성공<br>";
    } else {
        echo"로그인실패";
    }
    $r->db->close();
}
